<template>
  <div>
    <div class="top">
      <div class="title">预告片</div>
      <div class="box">
        <div
          class="item"
          v-for="(item, index) in data"
          :key="index"
          @click="goAdeio(img[index].url, item.title, item.onlineTime)"
        >
          <div class="imgbox">
            <img class="aimg" :src="img[index].imgUrl" alt="" />
          </div>
          <div class="tit two-text">{{ item.title }}</div>
          <div class="di">
            <div class="di1"> 
              <div class="tou">
                <img
                  class="auto-img"
                  :src="tou[index].avatarurl"
                  alt=""
                  v-lazy="tou[index].avatarurl"
                />
              </div>
              <div class="text one-text">{{ tou[index].nickName }}</div>
            </div>
            <div class="di1">
              <div class="dimg"><van-icon name="like-o" /></div>
              <div class="dsum">{{ item.upCount }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
    
    <script>
export default {
  name: "Water1",
  data() {
    return {
      data: [],
      img: [],
      tou: [],
    };
  },
  created() {
    this.getVideo();
  },
  methods: {
    getVideo() {
      this.axios({
        method: "get",
        url: "https://apis.netstart.cn/maoyan/video/0",
      })
        .then((result) => {
          this.$toast("加载成功！");
          this.data = result.data.data.feeds;
          result.data.data.feeds.forEach((v) => {
            if (v.video === undefined) {
              v.video = {
                dur: 26,
                height: 720,
                id: 10060142,
                imgUrl:
                  "http://p0.meituan.net/movie/10b45f02e364170c623fe03219acfa0b30231.jpg",
                url: "https://vod.pipi.cn/fec9203cvodtransbj1251246104/a4ffaa74387702298605134356/v.f42905.mp4",
                viewCount: 0,
                width: 1278,
              };
            }
            this.img.push(v.video);
            this.tou.push(v.user);
          });
        })
        .catch((err) => {});
    },
    goAdeio(url, title, time) {
      this.$router.push({ name: "Adeio", params: { url, title, time } });
    },
  },
};
</script>
    
<style lang="less" scoped>
.top {
  width: 96%;
  background-color: #fff;
  margin: 0 auto;
  border-radius: 10px;
  margin-bottom: 10px;
  .title {
    margin-left: 10px;
    line-height: 50px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
  }
}
.box {
  width: 96%;
  display: flex;
  justify-content: space-between;
  flex-flow: wrap;
  margin: 0 auto;
  padding: 0px 5px 5px;
}
.item {
  width: 48.5%;
  margin-bottom: 10px;
  border-radius: 10px;
  background-color: #fcfafa;
  overflow: hidden;
  padding-bottom: 6px;
  .imgbox {
    width: 100%;
    .aimg {
      width: 100%;
      height: 119px;
    }
  }
  .tit {
    width: 100%;
    font-size: 16px;
    color: #444;
  }
  .di {
    width: 100%;
    height: 20px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    padding: 5px 10px 20px;
    box-sizing: border-box;
    text-align: center;
    line-height: 20px;
    .di1 {
      display: flex;
      .tou {
        width: 20px;
        height: 20px;
        margin-right: 5px;
      }
      .text {
        width: 66px;
        height: 25px;
      }
    }
  }
}
</style>
